package com.pro.api;

import com.pro.bean.VipSetmeal;
import com.pro.dto.Dto;
import com.pro.service.VipSetmealService;
import com.pro.util.dtoUtil.DtoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("VipSetmealall")
public class VipSetmealController {

    //注入服务层
    @Autowired
    private VipSetmealService vipSetmealService;

    /**
     * 查询数据表中所有数据
     * 返回：多条数据List<VipSetmeal>
     * **/
    @GetMapping(value = "all")
    public List<VipSetmeal> all(){
        return vipSetmealService.all();
    }

    //增加
    @PostMapping("add")
    public Dto ins(@RequestBody VipSetmeal vipSetmeal){
            return DtoUtil.returnSuccess(vipSetmealService.add(vipSetmeal));

        }

    //更改
    @PostMapping("upd")
    public Dto upd(@RequestBody VipSetmeal vipSetmeal){
        return DtoUtil.returnSuccess(vipSetmealService.upd(vipSetmeal));
    }

    //删除
    @GetMapping("del")
    public Dto del(int id){
        return DtoUtil.returnSuccess(vipSetmealService.del(id));
    }
}



